﻿using System;
using System.Collections;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

using DQS.Core.Log;
using DQS.EL;

public partial class Operate_Index : DQS_Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DQ_USERS user = (DQ_USERS)Session["LoginUser"];
            if (user.IS_ADMIN.Equals("Y"))
            {
                queryMenu.Style.Add("display", "none");
                myQueryMenu.Style.Add("display", "none");
                Page.ClientScript.RegisterStartupScript(GetType(), "admin"
                    , "Ext.onReady(function(){window.frames['DqsFrame'].location.href='../Support/UserManage.aspx';});", true);
            }
            else
            {
                manageMenu.Style.Add("display", "none");
                Page.ClientScript.RegisterStartupScript(GetType(), "admin"
                    , "Ext.onReady(function(){window.frames['DqsFrame'].location.href='Columns.aspx';});", true);
            }           
        }
    }

    protected void LBlogout_Click(object sender, EventArgs e)
    {
        if (Session["LoginUser"] != null)
        {
            DQ_USERS userlogin = (DQ_USERS)Session["LoginUser"];
            Log.Instance(this).Info("{ClientIP:'" + Tool.GetClientIP() + "',Msg:'" + userlogin.USER_LOGIN + " logout.'}");
        }
        Session["LoginUser"] = null;
        Response.Redirect("~/Login.aspx");
    }
}
